package com.wisdom.server.runner;

import com.wisdom.server.register.RpcRegister;
import com.wisdom.server.rpc.RpcServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @description: <rpc server run>
 * @author: Leo
 * @date:2021-08-21 19:02
 */
@Component
@Slf4j
public class RpcServerRunner {

    @Autowired
    private RpcRegister rpcRegister;

    @Autowired
    private RpcServer rpcServer;

    /**
     * 起点rpc server
     */
    public void run(){
        /*
            1. 向Nacos注册服务
            2. 基于Netty，启动服务  监听端口  接收连接
         */
        //1. 向Nacos注册服务
        rpcRegister.serverRegister();

        //2. 启动Netty server端
        rpcServer.rpcServerStart();
    }

}
